package com.buss.base.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.buss.base.dao.BranchDao;
import com.buss.base.model.Branch;
import com.buss.base.service.BranchService;
import com.buss.core.dic.RecordStatus;
import com.buss.core.persistence.OrderBy;
import com.buss.core.persistence.Paginalbe;
import com.buss.core.persistence.ResultList;

@Service
public class BranchServiceImpl implements BranchService {

	@Autowired
	private BranchDao branchDao;
	
	@Override
	public Branch saveBranch(Branch branch) {
		return branchDao.saveBranch(branch);
	}

	@Override
	public void editBranch(Branch branch) {
		branchDao.editBranch(branch);
	}

	@Override
	public void deleteBranch(Long[] ids) {
		branchDao.deleteBranch(ids);
	}

	@Override
	public Branch loadBranch(Long id) {
		return branchDao.loadBranch(id);
	}

	public void updateStatus(Long[] ids,RecordStatus status){
		branchDao.updateStatus(ids, status);
	}
	
	@Override
	public ResultList<Branch> queryBranch(String companyId, String name,
			String pinyin, RecordStatus status,Paginalbe page, OrderBy orderBy) {
		return branchDao.queryBranch(companyId, name, pinyin,status, page, orderBy);
	}

	public ResultList<Branch> queryBranch(String companyId,Long[] branchIds){
		return branchDao.queryBranch(companyId, branchIds);
	}
	
	public ResultList<Branch> queryBranchByRole(Long[] roleIds,RecordStatus status,Paginalbe page){
		return branchDao.queryBranchByRole(roleIds,status, page);
	}
	
	public void saveBranchRole(Long roleId,Long[] branchIds){
		branchDao.saveBranchRole(roleId, branchIds);
	}
	
	public void saveCancelBranch(Long roleId,Long[] branchIds){
		branchDao.saveCancelBranch(roleId, branchIds);
	}
}
